from langchain_openai import ChatOpenAI
from langchain_openai import OpenAIEmbeddings
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser
from langchain_community.document_loaders import WebBaseLoader

llm = ChatOpenAI(base_url="https://api.gpts.vin/v1",
                 api_key="sk-ELq6vE96xLlCHWjR21D8D93168604d2f975dF2572683464f")
# print(llm.invoke("how can langsmith help with testing?"))

prompt = ChatPromptTemplate.from_messages([
    ('system', 'You are world class technical documentation writer.'),
    ('user', '{input}')
])

output_parser = StrOutputParser()

chain = prompt | llm | output_parser
result = chain.invoke({'input' : 'how can langsmith help with testing?'})
print(result)

loader = WebBaseLoader("https://docs.smith.langchain.com/user_guide")
docs = loader.load()

embeddings = OpenAIEmbeddings()